home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / msdos / mxmenu.zip / UTILS.INC < prev    next >
Text File  |  1993-03-29  |  11KB  |  549 lines

  1. Comment
  2. ==========================================================
  3.  
  4. This include file contains a lot of useful utilities. It is
  5. smart enough to present the netware choices only if connected
  6. to a novell network.
  7.  
  8. =========================================================
  9. EndComment
  10.  
  11. ;----- Create Variables
  12.  
  13. Var
  14.   PortChoices
  15.   MyServer
  16.   AllUsers
  17.   NetAddress
  18.   Station
  19.   UserName
  20.   BMess
  21.   TitleBackColor
  22.   TitleInsideColor
  23.   PersonalMenu
  24.   FilePicked
  25.   NovCon
  26.  
  27.  
  28. ;=============[ Util Menu ]============*
  29.  
  30. :Util
  31.  
  32. if NetworkVersion then NovCon = NovConnection <> 0
  33.  
  34. ;----- Port Choices
  35.  
  36. PortChoices = Set ['Lpt1','Lpt2','Lpt3']
  37.  
  38.  
  39. AddChoice('Format Disk Menu',1)
  40. AddChoice('Dos Functions',2)
  41. if NovCon
  42.    AddChoice('Printer Select',3)
  43.    AddChoice('Novell Information',4)
  44.    AddChoice('Novell User Options',5)
  45.    if NovConsoleOperator
  46.       AddChoice('Novell Utilities',6)
  47.       AddChoice('Maintainence',7)
  48.       AddChoice('Menu Utilities',8)
  49.       AddChoice('Command Line',9)
  50.    endif
  51. endif
  52. if not NovCon
  53.    AddChoice('Menu Utilities',8)
  54.    AddChoice('Command Line',9)
  55. endif
  56.  
  57. CornerStretchBox ('Utility Menu',43,6)
  58.  
  59. OnKey Task(1)
  60.   |SelectFormat
  61.   |LastKey = ' '
  62.  
  63. OnKey Task(2)
  64.   ^Dos
  65.  
  66. OnKey Task(3)
  67.   |SelectPrintQueue
  68.   |Dispose Choices
  69.   |LastKey = ' '
  70.  
  71. OnKey Task(4)
  72.   ^NovInfo
  73.  
  74. OnKey Task(5)
  75.   ^NovUser
  76.  
  77. OnKey Task(6)
  78.   ^NovUtils
  79.  
  80. OnKey Task(7)
  81.   ^Maint
  82.  
  83. OnKey Task(8)
  84.   ^MenuUtil
  85.  
  86. OnKey Task(9)
  87.   |if ExistOnPath('DOLIST.EXE') > ''
  88.      DropTo DoList
  89.   |else
  90.   |  Bat 'DropTo ' + ReadEnv('COMSPEC')
  91.   |endif
  92.  
  93. ;=============[ Dos Menu ]============*
  94.  
  95. :Dos
  96.  
  97. AddChoice('Directory Master',1)
  98. AddChoice('Pick Directory',2)
  99. AddChoice('Show Directory',3)
  100. AddChoice('Free Space',4)
  101. AddChoice('Memory Map',5)
  102. AddChoice('Device Drivers',6)
  103.  
  104. CenterStretchBox ('DOS Menu',38,15)
  105.  
  106. OnKey Task(1)
  107.   |if NovConsoleOperator
  108.      DropTo DM3
  109.   |else
  110.      DropTo DMLITE
  111.   |endif
  112.  
  113. OnKey Task(2)
  114.    PD
  115.  
  116. OnKey Task(3)
  117.    D/W
  118.  
  119. OnKey Task(4)
  120.    Free
  121.    Pause
  122.  
  123. OnKey Task(5)
  124.    RamMap
  125.    Pause
  126.  
  127. OnKey Task(6)
  128.    Device
  129.    Pause
  130.  
  131.  
  132. ;=============[ Maintenence Menu ]============*
  133.  
  134. :Maint
  135.  
  136. AddChoice('Tape Backup',1)
  137. AddChoice('Delete *.BAK Files',2)
  138. AddChoice('Delete *.MRX Files',3)
  139.  
  140. CenterStretchBox ('Maintenence Menu',38,15)
  141.  
  142. OnKey Task(1)
  143.    |Error('Put Code for your Tape Backup Software here.')
  144.  
  145. OnKey Task(2)
  146.    Whereis *.BAK /D
  147.  
  148. OnKey Task(3)
  149.    Whereis *.MRX /D
  150.  
  151.  
  152. ;=============[ Menu Utilities Menu ]============*
  153.  
  154. :MenuUtil
  155.  
  156. AddChoice('Edit this Menu',1)
  157. AddChoice('View Include Files',2)
  158. AddChoice('Edit Include Files',3)
  159. AddChoice('View a Menu File',4)
  160. AddChoice('Edit a Menu File',5)
  161. AddChoice('Run a Menu',6)
  162. AddChoice('Load MarxHelp',7)
  163. AddChoice('UnLoad MarxHelp',8)
  164.  
  165. CenterStretchBox ('Menu Utilities',38,15)
  166.  
  167. OnKey Task(1)
  168.    ME %MenuFileName
  169.  
  170. OnKey Task(2)
  171.    |FilePicked = PickAFile('*.INC','Include Files')
  172.    |ViewFile(FilePicked)
  173.  
  174. OnKey Task(3)
  175.    |FilePicked = GetIncludeFile
  176.    |if FilePicked > ''
  177.    |   Bat 'ME ' + FilePicked
  178.    |endif
  179.  
  180. OnKey Task(4)
  181.    |FilePicked = PickAFile ('*.MNU','Menus')
  182.    |ViewFile(FilePicked)
  183.  
  184. OnKey Task(5)
  185.    |FilePicked = PickAFile ('*.MNU','Menus')
  186.    |if FilePicked > ''
  187.    |   Bat 'ME ' + FilePicked
  188.    |endif
  189.  
  190. OnKey Task(6)
  191.    |FilePicked = PickAFile ('*.MNU','Menus')
  192.    |if FilePicked > ''
  193.    |   Bat 'MARX ' + FilePicked
  194.    |endif
  195.  
  196. OnKey Task(7)
  197.    |MxCmd = 'MarxHelp'
  198.  
  199. OnKey Task(8)
  200.    |MxCmd = 'MarxHelp /U'
  201.  
  202.  
  203. ;=============[ Format Menu ]============*
  204.  
  205. Procedure SelectFormat
  206. var Ch Message Option
  207.  
  208.    DrawTheBox(20,12,42,4 + HeightDifference,'Format Floppy Disk Menu')
  209.  
  210.    Writeln ' 1 - Format 360    5 - Format /S 360'
  211.    Writeln ' 2 - Format 1.2M   6 - Format /S 1.2M'
  212.    Writeln ' 3 - Format 720    7 - Format /S 720'
  213.    Write   ' 4 - Format 1.4M   8 - Format /S 1.4M'
  214.  
  215.    Ch = ReadKey
  216.  
  217.    if Ch = '1'
  218.       Message = '360k Format with no System Files.'
  219.       Option = '/4'
  220.  
  221.    elseif Ch = '2'
  222.       Message = '1.2m Format with no System Files.'
  223.       Option = ''
  224.  
  225.    elseif Ch = '3'
  226.       Message = '720k Format with no System Files.'
  227.       Option = '/N:9/T:80'
  228.  
  229.    elseif Ch = '4'
  230.       Message = '1.4m Format with no System Files.'
  231.       Option = '/N:18/T:80'
  232.  
  233.    elseif Ch = '5'
  234.       Message = '360k Format with System Files.'
  235.       Option = '/4/S'
  236.  
  237.    elseif Ch = '6'
  238.       Message = '1.2m Format with System Files.'
  239.       Option = '/S'
  240.  
  241.    elseif Ch = '7'
  242.       Message = '720k Format with System Files.'
  243.       Option = '/N:9/T:80/S'
  244.  
  245.    elseif Ch = '8'
  246.       Message = '1.4m Format with System Files.'
  247.       Option = '/N:18/T:80/S'
  248.  
  249.    else
  250.       Return
  251.  
  252.    endif
  253.  
  254.    if DosVersionString >= '5.00'
  255.       Option = Option + '/U'     ;unconditional
  256.       Option = Option + '/V:DOS' ;automatically adds volume label
  257.    endif
  258.  
  259.    DrawTheBox(46,18,11,2 + HeightDifference,'Drive')
  260.    Writeln '  A:'
  261.    Write   '  B:'
  262.    Ch = ReadKey
  263.    if Ch = Esc then Return
  264.    ExecFormat(Ch,Option,Message)
  265. EndProc
  266.  
  267. ;----- Execute FORMAT in a DOS Window
  268.  
  269. Procedure ExecFormat (Drv,Option,Message)
  270. var FormatProg
  271.  
  272.    FormatProg = ExistOnPath('FORMAT.EXE')
  273.    if FormatProg = '' then FormatProg = ExistOnPath('FORMAT.COM')
  274.    if FormatProg = ''
  275.       Error('FORMAT program not Found!')
  276.       Return
  277.    endif
  278.  
  279.    BoxHeader = ' Formatting Drive ' + Drv + ': ' + Message + ' '
  280.    Shadow Off
  281.    DrawBox 1 4 80 21
  282.    Window  4 5 74 19
  283.    Writeln
  284.    ExecProg (FormatProg + ' ' + Drv + ': ' + Option)
  285.    EraseTopWindow
  286. EndProc
  287.  
  288.  
  289. ;=============[ Novell Utilities Menu ]============*
  290.  
  291. :NovUtils
  292.  
  293. AddChoice('Session Management',1)
  294. AddChoice('File Management',2)
  295. AddChoice('Volume Information',3)
  296. AddChoice('System Configuration',4)
  297. AddChoice('File Server Monitoring',5)
  298. AddChoice('Print Queue Management',6)
  299. AddChoice('Print Job Configurations',7)
  300. AddChoice('Printer Definitions',8)
  301. AddChoice('Folio Help System',9)
  302.  
  303. CenterStretchBox ('Novell Utilities',38,15)
  304.  
  305. OnKey Task(1)
  306.    Session
  307.  
  308. OnKey Task(2)
  309.    Filer
  310.  
  311. OnKey Task(3)
  312.    VolInfo
  313.  
  314. OnKey Task(4)
  315.    Syscon
  316.  
  317. OnKey Task(5)
  318.    FConsole
  319.  
  320. OnKey Task(6)
  321.    PConsole
  322.  
  323. OnKey Task(7)
  324.    PrintCon
  325.  
  326. OnKey Task(8)
  327.    PrintDef
  328.  
  329. OnKey Task(9)
  330.    P:Help
  331.  
  332.  
  333. ;=============[ Novell Information Menu ]============*
  334.  
  335. :NovInfo
  336.  
  337. AddChoice('UserList',1)
  338. AddChoice('Drive Map',2)
  339. AddChoice('Current Dir',3)
  340. AddChoice('Directory Rights',4)
  341. AddChoice('List Servers',5)
  342. AddChoice('Who Am I?',6)
  343. AddChoice('Trustees',7)
  344. AddChoice('System Time',8)
  345. AddChoice('ChkVol',9)
  346. AddChoice('Printer Status',10)
  347.  
  348. CenterStretchBox ('Novell Information',38,15)
  349.  
  350. OnKey Task(1)
  351.    UserList/A
  352.    Echo.
  353.    Pause
  354.  
  355. OnKey Task(2)
  356.    Map
  357.    Echo.
  358.    Pause
  359.  
  360. OnKey Task(3)
  361.    NDir
  362.    Pause
  363.  
  364. OnKey Task(4)
  365.    Rights
  366.    Echo.
  367.    Pause
  368.  
  369. OnKey Task(5)
  370.    SList
  371.    Echo.
  372.    Pause
  373.  
  374. OnKey Task(6)
  375.    WhoAmI/A
  376.    Echo.
  377.    Pause
  378.  
  379. OnKey Task(7)
  380.    TList
  381.    Echo.
  382.    Pause
  383.  
  384. OnKey Task(8)
  385.    SysTime
  386.    Echo.
  387.    Pause
  388.  
  389. OnKey Task(9)
  390.    ChkVol
  391.    Echo.
  392.    Pause
  393.  
  394. OnKey Task(10)
  395.    Capture Show
  396.    Echo.
  397.    Pause
  398.  
  399.  
  400. ;=============[ Novell User Menu ]============*
  401.  
  402. :NovUser
  403.  
  404. AddChoice('Change Password',1)
  405. AddChoice('Block Messages',2)
  406. AddChoice('Receive Messages',3)
  407. AddChoice('End Printer Capture',4)
  408. AddChoice('Send a Message',5)
  409.  
  410. CenterStretchBox ('Novell User Menu',38,15)
  411.  
  412. OnKey Task(1)
  413.    SetPass
  414.  
  415. OnKey Task(2)
  416.    CastOff
  417.  
  418. OnKey Task(3)
  419.    CastOn
  420.  
  421. OnKey Task(4)
  422.    EndCap
  423.  
  424. OnKey Task(5)
  425.    |SendMessage
  426.  
  427. ;----- This routines selects a print queue
  428.  
  429. Procedure SelectPrintQueue
  430. var Queues Queue PrnPort QCmd LocalName Servers Server
  431.  
  432.    NovAttachedServers(Servers)
  433.    if NumberOfElements(Servers) > 1
  434.       SortArray(Servers)
  435.       DrawTheBox(15,13,23,Min(12,NumberOfElements(Servers) + HeightDifference),'Servers')
  436.       Server = PickOne(Servers)
  437.       if LastKey = Esc then Return
  438.       NovPreferredServer = Server
  439.    else
  440.       Server = NovDefaultServer
  441.    endif
  442.  
  443.    LocalName = '<Local Printer>'
  444.    NovMyPrintQueues(Queues)
  445.    SortArray(Queues)
  446.    AppendArray(Queues,LocalName)
  447.  
  448.    DrawTheBox(28,11,23,Min(12,NumberOfElements(Queues) + HeightDifference),'Print Queues')
  449.    Queue = PickOne(Queues)
  450.    if LastKey = Esc
  451.       Return
  452.    endif
  453.  
  454.    Choices = PortChoices
  455.    CenterStretchBox ('Port',38,20)
  456.    PrnPort = Ord(ReadKey) - 64
  457.    if LastKey = Esc then Return
  458.    EraseTopWindow
  459.  
  460.    if Queue = LocalName
  461.       NovEndCapture (PrnPort)
  462.    else
  463.       NovCaptureQueue (PrnPort) = Server + '/' + Queue
  464.       NovCaptureTimeOut (PrnPort) = 5
  465.    endif
  466.  
  467. EndProc
  468.  
  469. ;----- Sends a novell message
  470.  
  471. Procedure SendMessage
  472. var Choice Message
  473.    Choice = PickUser('Send message To')
  474.    if Choice = '' then Return
  475.    Message = ReadTextLine('Message:','',0,21)
  476.    if LastKey = Esc then Return
  477.    ClearScreen
  478.    TextColor MenuHeaderFG MenuBG
  479.    Write ' Sending ... '
  480.    ClearScreenFirst Off
  481.    ExecProg ('Send "' + Message + '" to ' + Choice + '>nul')
  482. EndProc
  483.  
  484. ;----- Select Include File
  485.  
  486. Procedure GetIncludeFile
  487. var IncPath Picked
  488.    IncPath = PathPart(ExistOnPath('CUSTOM.INC'))
  489.    Picked = PickAFile(CleanFileName(IncPath + '\*.INC'),'Include Files')
  490.    if Picked = '' then Return ''
  491.    DelFile(ForceExtension(%MenuFileName,'MRX'))
  492.    Return CleanFileName(IncPath + '\' + Picked)
  493. EndProc
  494.  
  495. ;----- Reads a list of all users on the system
  496.  
  497. Procedure ReadUsers
  498.    if NumberOfElements(AllUsers) > 0 then Return
  499.    NovUsersLoggedIn(AllUsers)
  500.    SortArray(AllUsers)
  501. EndProc
  502.  
  503.  
  504. Procedure PickUser (Message)
  505. var MaxSize
  506.    ReadUsers
  507.    MaxSize = Min(15,NumberOfElements(AllUsers))
  508.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  509.    Return PickOne(AllUsers)
  510. EndProc
  511.  
  512. ;----- Execute a program in a window
  513.  
  514. Procedure ExecProg (Prog)
  515.    TextColor MenuHeaderFG MenuBG
  516.    Cursor Off
  517.    DosWindow
  518.    Execute Prog
  519. EndProc
  520.  
  521.  
  522. Procedure PickAFile (Mask,Message)
  523. var Files Choice MaxSize
  524.    ReadDirectory(Mask,Files)
  525.    MaxSize = Min(15,NumberOfElements(Files))
  526.    if MaxSize = 0
  527.       Error('No Choices!')
  528.       Return ''
  529.    endif
  530.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  531.    Choice = PickOne(Files)
  532.    Return Choice
  533. EndProc
  534.  
  535. ;----- Display Error and Wait for a Key
  536.  
  537. Procedure Error (Err)
  538. var Ch
  539.    BoxHeader = ' Error * Press any Key '
  540.    DrawBox 11 19 Max(27,length(Err) + 4) 3
  541.    Cursor Off
  542.    UseArrows Off
  543.    TextColor MenuHeaderFG MenuBG
  544.    WriteCenter Err
  545.    Write Char(7)
  546.    Ch = ReadKey
  547.    EraseTopWindow
  548. EndProc
  549.